{include file="public/_meta" /}
<body>
<style>
    .required_b{
        color: red;
    }
</style>
<div class="wrapper">

    {include file="public/_header" /}

    <!-- Sidebar -->
    {include file="public/_menu" /}
    <!-- End Sidebar -->

    <div class="main-panel">

        <div class="content">
            <div class="page-inner">

                <!-- 面包屑 -->
                {include file="public/_page_header" /}

                <div class="row">
                    <div class="col-md-12">
                        <div class="card">
                            <div class="card-header">
                                <div class="d-flex align-items-center">
                                    <h4 class="card-title">消耗明细</h4>
                                </div>

                                <form class="row">
                                    {if condition="!in_array($group_id,[4,5])"}
                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <select class="form-control" name="adv_id">
                                                <option value="">全部账户</option>
                                                <option value="9999" {if condition="$adv_id eq '9999'"}selected{/if}>【手动添加的线索】</option>
                                                {volist name="accounts" id="vo"}
                                                <option value="{$vo.adv_id}" {if condition="$vo.adv_id eq $adv_id"}selected{/if}>{$vo.acc_name}</option>
                                                {/volist}
                                            </select>
                                        </div>
                                    </div>
                                    {/if}

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <select class="form-control" name="mer_id">
                                                <option value="">全部商户</option>
                                                {volist name="merchants" id="vo"}
                                                <option value="{$vo.id}" {if condition="$vo.id eq $mer_id"}selected{/if}>{$vo.mer_name}</option>
                                                {/volist}
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">

                                            <select class="form-control input-full" name="pro_id" id="pro_id">
                                                <option value="">全部产品</option>
                                                {volist name="products" id="vo"}
                                                <option value="{$key}" {if condition="$key eq $pro_id"}selected{/if}>{$vo}</option>
                                                {/volist}
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="cityname" value="{$cityname}" placeholder="请输入城市">
                                        </div>
                                    </div>


                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="time" id="time" value="{$time}" placeholder="投放时间">
                                        </div>
                                    </div>



                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <button type="submit" class="btn btn-primary">查询</button>
                                            <a href="{:url('stat/consume')}" class="btn btn-info" style="color: white;position: absolute;left: 110px;">重置</a>
                                        </div>
                                    </div>

                                </form>

                            </div>

                            <div class="layui-card-body">

                                <blockquote class="layui-elem-quote layui-quote-nm">
                                    <span style="margin-right: 50px;">线索总量：{$clue_num}</span><span style="margin-right: 50px;">去重线索总量：{$clue_dis_num}</span><span style="margin-right: 50px;">金额合计：{$prices}</span>

                                </blockquote>
                            </div>


                            <div class="card-body">

                                <div class="table-responsive">
                                    <table id="add-row" class="display table table-striped table-hover" >
                                        <thead>
                                        <tr>
                                            <th>ID</th>
                                            <th>日期</th>
                                            {if condition="!in_array($group_id,[4,5])"}
                                            <th>投放账号ID</th>
                                            <th>投放账户</th>
                                            {/if}
                                            <th>投放产品</th>
                                            <th>商户</th>
                                            <th>投放城市</th>
                                            <th>线索总量</th>
                                            <th>去重线索总量</th>
                                            <th>收费方式</th>
                                            <th>金额 </th>
                                        </tr>
                                        </thead>

                                        <tbody>

                                        {volist name="infos" id="vo"}
                                        <tr>
                                            <td>{$vo.id}</td>
                                            <td>{$vo.time}</td>
                                            {if condition="!in_array($group_id,[4,5])"}
                                            <td>{$vo.adv_id}</td>
                                            <td>{$vo.acc_name}</td>
                                            {/if}
                                            <td>{$vo.pro_name}</td>
                                            <td>{$vo.mer_name}</td>
                                            <td>{$vo.city}</td>
                                            <td>{$vo.clue_num}</td>
                                            <td>{$vo.clue_dis_num}</td>
                                            <td>{$vo.charge_type}</td>
                                            <td>{$vo.prices}
                                                {if condition="$vo.charge_type eq '按服务收费'"}
                                                <i onClick="editPrices('{$vo.id}')" class="fa fa-edit" style="cursor:pointer;color:#48abf7!important;"></i>
                                                {/if}
                                            </td>
                                        </tr>
                                        {/volist}

                                        </tbody>
                                    </table>

                                    <!-- 分页 (调取通用方法)-->
                                     <div class="layui-box layui-laypage layui-laypage-molv">{:pagination($infos)}</div>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>


            </div>
        </div>

        {include file="public/_footer" /}


    </div>



</div>

{include file="public/_js" /}

</body>

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
    var SCOPE = {
        'item_url':"{:url('stat/edit_prices')}",
    };

    function editPrices(id)
    {
        layer.prompt({
            formType: 3,
            value: '',
            title: '修改金额【ID：'+id+'】',
            area: ['300px'] //自定义文本域宽高
        }, function(value, index, elem){

            if(isNaN(Number(value))){  //当输入不是数字的时候，Number后返回的值是NaN;然后用isNaN判断。
                layer.msg('请输入数字！',{icon: 2,time:1000});return false;
            }

            var url = SCOPE.item_url;
            $.post(url,{prices:value,id:id},function(data){
                if(data.code == 1001){
                    layer.msg(data.msg,{icon: 1,time:1000},function(){
                        window.location.reload();
                    });
                }else{
                    layer.msg(data.msg,{icon: 2,time:1000});return false;
                }

            });

        });
    }

    // laydate.render({
    //     elem: '#time'
    //     ,type: 'date'
    // });

    laydate.render({
        elem: '#time'
        ,type: 'datetime'
        ,range: true
    });
</script>
</html>




























